home *** CD-ROM | disk | FTP | other *** search
- /**************************************************************************
- * *
- * Copyright (C) 1996, Silicon Graphics, Inc. *
- * All Rights Reserved. *
- * *
- * The files in this subtree contain UNPUBLISHED PROPRIETARY SOURCE *
- * CODE of Silicon Graphics, Inc.; the contents of these files may *
- * not be disclosed to third parties, copied or duplicated in any *
- * form, in whole or in part, without the prior written permission *
- * of Silicon Graphics, Inc. *
- * *
- * RESTRICTED RIGHTS LEGEND: *
- * Use, duplication or disclosure by the Government is subject to *
- * restrictions as set forth in subdivision (c)(1)(ii) of the Rights in *
- * Technical Data and Computer Software clause at DFARS 252.227-7013, *
- * and/or in similar or successor clauses in the FAR, DOD or NASA FAR *
- * Supplement. Unpublished - rights reserved under the Copyright Laws *
- * of the United States. *
- * *
- * THIS SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, *
- * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY *
- * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. *
- * *
- * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, *
- * INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY *
- * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, *
- * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY *
- * THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR *
- * PERFORMANCE OF THIS SOFTWARE. *
- **************************************************************************/
-
- /*
- Author : Paul Hansen & Patrick Bouchaud
- hansen@engr.sgi.com galaad@neu.sgi.com
- */
-
-
- /*---------------------------------------------------------------------------*/
- /* data structures
- /*---------------------------------------------------------------------------*/
- typedef struct _vertex
- {
- GLdouble x, y, z;
- int in;
- struct _vertex *next, *last;
- }
- Vertex;
-
- #define CULLED_IN 0
- #define CULLED_OUT 1
- #define CLIPPED_START 2
- #define CLIPPED_END 3
- typedef struct _segment
- {
- Vertex *start, *end;
- int state;
- struct _segment *next, *last;
- }
- Segment;
-
- typedef struct _edge
- {
- Segment *segment;
- int inverted;
- struct _edge *next, *last;
- }
- Edge;
-
- typedef struct _face
- {
- int numEdge;
- Edge *firstEdge; /* ring-buffer */
- GLdouble equation[4];
- struct _face *next, *last;
- }
- Face;
-
- typedef struct _volume
- {
- int numVertex;
- Vertex *firstVertex, *lastVertex;
-
- int numSegment, numNewSegment;
- Segment *firstNewSegment, *firstSegment, *lastSegment;
-
- int numFace;
- Face *firstFace, *lastFace;
-
- struct _volume *next;
- }
- Volume;
-
- /*---------------------------------------------------------------------------*/
- /* data
- /*---------------------------------------------------------------------------*/
-
- static GLdouble xdim, zdim;
- static Volume *pyramid = NULL;
-
- static Segment *newSegment( Volume *, Vertex *, Vertex * );
- static Face *newFace( int, GLdouble * );
- static void deleteVolume( Volume * );
- static Volume *newFrustumPyramid();
- static Vertex *ClipLine3D( Vertex *, Vertex *, GLdouble * );
- static void ClipVolume( Volume *, GLdouble * );
- static void BBoxClip( Volume *, float, float, float, float, float, float );
- static int getMinMaxLat( Volume *, float *, float * );
- static int getMinMaxLon( Volume *, float, float *, float * );
-
- #define equate(v,eq) (eq[0]*v->x + eq[1]*v->y + eq[2]*v->z + eq[3])
-
-